package com.ymatou.iapi.liveseller.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.liveseller.parameter.GetModelDetailBean;
import com.ymatou.iapi.liveseller.parameter.GetModelDetailResp;
import com.ymatou.iapi.liveseller.service.GetModelDetailCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.LiveRoomCallService;
/**
*查询模特信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetModelDetail{
	private static GetModelDetailBean getmodeldetailBean;
	private static GetModelDetailCall getmodeldetailCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询模特信息");
	}

	@Before
	public void caseUp() {
		getmodeldetailBean=new GetModelDetailBean();
		getmodeldetailCall=new GetModelDetailCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getmodeldetailCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetModelDetail_001() {
		Logger.start(true,"查询模特信息成功");
		try {
			int liveid=1;
			int userid=1;
			LiveRoomCallService.DeleteModel(userid);
			int id=LiveRoomCallService.CreateModelCall(userid, 1, 2, "nick");
			getmodeldetailBean.setModelId(id);
			getmodeldetailCall.setData(getmodeldetailBean);
			getmodeldetailCall.callService();			
			Logger.verifyEquals("200", getmodeldetailCall.getString("Code"), "验证code");		
			GetModelDetailResp m = getmodeldetailCall.getModelDetailResp();
			Logger.verifyEquals("nick", m.getNickName(), "验证getNickName");
			Logger.verifyEquals("2", m.getWeight(), "验证getWeight");
			Logger.verifyEquals("1", m.getHeight(), "验证getHeight");
//			Logger.verifyEquals(false, m.getChoose(), "验证getChoose");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_GetModelDetail_002() {
		Logger.start(true,"不输入modelId失败");
		try {
			getmodeldetailCall.setData(getmodeldetailBean);
			getmodeldetailCall.callService();			
			Logger.verifyEquals("400", getmodeldetailCall.getString("Code"), "验证code");		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_GetModelDetail_003() {
		Logger.start(true,"输入不存在modelId失败");
		try {
			getmodeldetailBean.setModelId(-1);
			getmodeldetailCall.setData(getmodeldetailBean);
			getmodeldetailCall.callService();			
			Logger.verifyEquals("400", getmodeldetailCall.getString("Code"), "验证code");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_GetModelDetail_004() {
		Logger.start(true,"输入modelId已删除失败");
		try {
			int liveid=1;
			int userid=1;
			LiveRoomCallService.DeleteModel(userid);
			int id=LiveRoomCallService.CreateModelCall(userid, 1, 2, "nick");
			LiveRoomCallService.DeleteModelById(id, userid);
			getmodeldetailBean.setModelId(id);
			getmodeldetailCall.setData(getmodeldetailBean);
			getmodeldetailCall.callService();			
			Logger.verifyEquals("201", getmodeldetailCall.getString("Code"), "验证code");		
			//模特信息不存在
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}